// 驱动类型下拉选择组件

export default function DriverSelect({ SetDriverName, driverList }) {
  const changeEvent = (e) => {
    SetDriverName(e.target.value);
  };

  return (
    <div className="mb-4">
      <label
        className="mb-2 block text-sm font-bold text-gray-700"
        htmlFor="select-box"
      >
        驱动类型
      </label>
      <div className="">
        <select
          id="driver-list"
          name="driver" // 这里 driver 和 formData 绑定
          className="select select-bordered w-full max-w-xl"
          onChange={(e) => changeEvent(e)}
        >
          {driverList &&
            driverList.map((item) => (
              <option key={item.id} value={item.name}>
                {item.name}
              </option>
            ))}
        </select>
      </div>
    </div>
  );
}
